package com.cy.java;

import org.junit.Test;

import static java.lang.System.out;

public class MathTest {

    @Test
    public void test() {
        try {
            out.println(f(9));
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    public int f(int n) throws IllegalAccessException {
        if(n<1){
            throw new IllegalAccessException(n+"不能小于1");
        }
        if(n==1||n==2){
            return n;
        }
        return f(n-2)+f(n-1);
    }
}


